scene_Start.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { _decorator, Component, director, Node } from 'cc';
  2. import { CheckButton } from './CheckButton';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('scene_Start')
  5. export class scene_Start extends Component {
  6. @property(CheckButton)
  7. checkButton1: CheckButton = null!;
  8. @property(CheckButton)
  9. checkButton2: CheckButton = null!;
  10. @property(CheckButton)
  11. checkButton3: CheckButton = null!;
  12. @property(CheckButton)
  13. checkButton4: CheckButton = null!;
  14. @property(CheckButton)
  15. checkButton5: CheckButton = null!;
  16. protected onEnable(): void {
  17. this.checkButton1.bindFunction((from: CheckButton) => {
  18. // 绑定函数逻辑
  19. console.log('CheckButton1 toggled:', from.onoff);
  20. director.loadScene('scene_BASE1');
  21. });
  22. this.checkButton2.bindFunction((from: CheckButton) => {
  23. // 绑定函数逻辑
  24. console.log('CheckButton2 toggled:', from.onoff);
  25. director.loadScene('scene_BASE2');
  26. });
  27. this.checkButton3.bindFunction((from: CheckButton) => {
  28. // 绑定函数逻辑
  29. console.log('CheckButton3 toggled:', from.onoff);
  30. director.loadScene('scene_HILLCLIMB');
  31. });
  32. this.checkButton4.bindFunction((from: CheckButton) => {
  33. // 绑定函数逻辑
  34. console.log('checkButton4 toggled:', from.onoff);
  35. director.loadScene('scene_ROPE');
  36. });
  37. this.checkButton5.bindFunction((from: CheckButton) => {
  38. // 绑定函数逻辑
  39. console.log('CheckButton5 toggled:', from.onoff);
  40. director.loadScene('scene_CLOSEDAREA');
  41. });
  42. }
  43. update(deltaTime: number) {}
  44. }